using B.S.NewMedical.Api.Write.Application.Command.Doctor;
using B.S.NewMedical.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace B.S.NewMedical.Api.Write.Controllers.Doctor
{
    [Route("api/[controller]")]
    [ApiController]
    public class DoctorController : ControllerBase
    {
        private readonly IMediator _mediator;

        public DoctorController(IMediator mediator)
        {
            _mediator = mediator;
        }

        /// <summary>
        /// 批量删除医生
        /// </summary>
        /// <param name="doctorIds">要删除的医生ID列表</param>
        /// <returns>删除结果</returns>
        [HttpDelete("batch")]
        public async Task<ApiResult<bool>> DeleteDoctors([FromBody] List<int> doctorIds)
        {
            return await _mediator.Send(new DeleteDoctorsCommand(doctorIds));
        }

        /// <summary>
        /// 删除单个医生
        /// </summary>
        /// <param name="id">要删除的医生ID</param>
        /// <returns>删除结果</returns>
        [HttpDelete("{id}")]
        public async Task<ApiResult<bool>> DeleteDoctor(int id)
        {
            return await _mediator.Send(new DeleteDoctorCommand(id));
        }
    }
} 